﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/view.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="Workflow.Resource" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
  <script type="text/javascript">

      $(function () {
          $('#FolderLevelA').combobox({ url: '/MSDEEM/GetFolderLevel?id=2',
              valueField: 'FolderCode',
              textField: 'FolderName',
              onSelect: function (node) {
                  // alert(node.FolderCode);
                  $('#FolderLevelB').combobox({
                      disabled: false,
                      url: '/MSDEEM/GetClassA?id=' + node.FolderCode,
                      valueField: 'FolderCode',
                      textField: 'FolderName'
                  });
              }
          });
      });
      function Search() {
          var queryParams = $('#tt').datagrid('options').queryParams;

          queryParams.FolderLevelA = $('#FolderLevelA').combobox('getValue');
          queryParams.FolderLevelB = $('#FolderLevelB').combobox('getValue');
          queryParams.WorkStatus = $('#WorkStatus').combobox('getValue');
          queryParams.FileName = $('#FileName').val();
          queryParams.InvoiceNo = $('#InvoiceNo').val();
          queryParams.ReceiveDateFrom = $('#ReceiveDateFrom').datebox('getValue');
          queryParams.ReceiveDateTo = $('#ReceiveDateTo').datebox('getValue');
          queryParams.CheckType = $('#CheckType').combobox('getValue');
          queryParams.Payment = $('#Payment').combobox('getValue');
          queryParams.Reason = $('#Reason').combobox('getValue');

          $('#tt').datagrid('options').queryParams = queryParams;
          $("#tt").datagrid('reload');
      }
      $(function () {
          $('#tt').datagrid({
              title: '<%=Global.Inquiry%>',
              iconCls: 'icon-edit',
              width: 700,
              height: 400,
              fit: true,
              remoteSort: true,
              singleSelect: false,
              idField: 'itemid',
              url: '/MSDEEM/GetData',
              fitColumns: true,
              striped: true,
              pageSize: 20,
              queryParams: {},
              pageList: [10, 20, 30, 50],
              columns: [[
					
                    { field: 'CaseNo', title: '<%=Global.CaseNo %>', sortable: 'true', width: 50 },
                      { field: 'BatchNo', title: '<%=Global.BatchNo %>', sortable: 'true', width: 40 },
					{ field: 'InvoiceNo', title: '<%=Global.InvoiceNoEEM %>', sortable: 'true', width: 95 },
					{ field: 'FileName', title: '<%=Global.FileName %>', sortable: 'true', width: 115
                    , formatter: function (value, row, index) {
                        var s = '<a href="#" class="tooltips" style="text-decoration:none;color:blue" onclick="tiffedit(' + row.CaseNo + ')" >' + row.FileName + ' </a> ';
                        return s;
                    }
					},
					{ field: 'FolderLevelA', combobox: true, title: '<%=Global.FolderLevelA %>', width: 60, sortable: 'true', align: 'right' },
                       { field: 'FolderLevelB', combobox: true, title: '<%=Global.FolderLevelB %>', width: 90, sortable: 'true', align: 'right' },
					{ field: 'CheckType', title: '<%=Global.CheckType %>', sortable: 'true', width: 80, align: 'right' },
                     { field: 'ReceiveDate', title: '<%=Global.ReceiveDate %>', width: 65, sortable: 'true', align: 'center' },
                    { field: 'WorkStatus', title: '<%=Global.WorkStatus %>', width: 60, sortable: 'true', align: 'center' },
                    { field: 'StatusDate', title: '<%=Global.StatusDate %>', width: 110, sortable: 'true', align: 'center' },
                   { field: 'Payment', title: '<%=Global.PaymentEEM %>', width: 60, sortable: true, align: 'center' },
                   { field: 'StatusOperator', title: '<%=Global.StatusOperatorEEM %>', width: 60, sortable: 'false', align: 'center' },
                   { field: 'CommentCode', title: '<%=Global.ReasonTitle %>', width: 95, sortable: 'false', align: 'center'},
                    { field: 'Operator', title: '<%=Global.OperatorEEM %>', width: 60, sortable: 'true', align: 'center' }
              //                      
              //					{ field: 'action', title: 'Action', width: 70, align: 'center',
              //					    formatter: function (value, row, index) {
              //					        if (row.editing) {
              //					            var s = '<a href="#" onclick="saverow(' + index + ')">Save</a> ';
              //					            var c = '<a href="#" onclick="cancelrow(' + index + ')">Cancel</a>';
              //					            return s + c;
              //					        } else {
              //					            var e = '<a href="#" onclick="editrow(' + index + ')">Edit</a> ';
              //					            var d = '<a href="#" class="easyui-linkbutton" iconCls="icon-cut" plain="true"  onclick="deleterow(' + index + ')">Delete</a>';
              //					            return e + d;
              //					        }
              //					    }
              //					}
				]],
              sortName: 'InvoiceNo',
              sortOrder: 'asc'
          });
      });

      function tooltips(value) {
          s = true;
          $.messager.alert('Comment', value);


      }
      var s = false;
      function unselect(index) {
          $('#tt').datagrid('unselectRow', index);

      }

    
      function tiffedit(id) {
          //            $('#tt').datagrid('selectRow', index);
          //            var row = $('#tt').datagrid('getSelected');

          window.open("/tiff/ViewTiffEEM?caseNo=" + id, "_blank", "fullscreen");
      }
      function Export() {
          var FolderLevelA = $('#FolderLevelA').combobox('getValue');
          var FolderLevelB = $('#FolderLevelB').combobox('getValue');
          var CheckType = $('#CheckType').combobox('getValue');
          var WorkStatus = $('#WorkStatus').combobox('getValue');
          var FileName = $('#FileName').val();
          var InvoiceNo = $('#InvoiceNo').val();
          var ReceiveDateFrom = $('#ReceiveDateFrom').datebox('getValue');
          var ReceiveDateTo = $('#ReceiveDateTo').datebox('getValue');
          // var OperatorID = $('#OperatorID').combobox('getValue');
          var Payment = $('#Payment').combobox('getValue');
          var Reason = $('#Reason').combobox('getValue');

          var querydata = "&FolderLevelA=" + FolderLevelA;
          querydata = querydata + "&WorkStatus=" + WorkStatus;
          querydata = querydata + "&FileName=" + FileName;
          querydata = querydata + "&InvoiceNo=" + InvoiceNo;
          querydata = querydata + "&ReceiveDateFrom=" + ReceiveDateFrom;
          querydata = querydata + "&ReceiveDateTo=" + ReceiveDateTo;
          //querydata = querydata + "&OperatorID=" + OperatorID;
          querydata = querydata + "&FolderLevelB=" + FolderLevelB;
          querydata = querydata + "&CheckType=" + CheckType;
          querydata = querydata + "&Payment=" + Payment;
          querydata = querydata + "&Reason=" + Reason;


          $('#form').form('submit', {
              url: '/MSDEEM/ExportCase?' + querydata,
              success: function (data) {
                  eval('data=' + data);
                  if (data.Success) {
                      // _user_form.form('clear');
                      $.messager.alert('<%=Global.InfoTitle %>', data.Message, 'info');
                  } else {
                      $.messager.alert('<%=Global.ErrorTitle %>', data.Message, 'error');
                  }
                  // window.location = '/User/Index';
                  // $("#tt").datagrid('reload');
              },
              onSubmit: function () {
                  //if (_user_form.valid())

                  return true;
                  // else
                  //    return false;
              }
          });

      }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
 <form class="easyui-layout" method="post" id="form" name="form" style=" width:100%;height: 710px;">
       <div region="center" >

    <table id="tt" class="easyui-datagrid" style="width: 600px; height: 250px" idfield="CaseNo"
        title="DataGrid with Toolbar" iconcls="icon-save" toolbar="#tb" rownumbers="true"
        pagination="true">
        <div id="tb" style="padding: 5px; height: auto">
        <div >
                <a href="#" class="easyui-linkbutton" iconcls="icon-search" onclick="Search();"><%=Global.Search%></a>
                <a href="#" class="easyui-linkbutton"  iconcls="icon-redo" onclick="Export();"> <%=Global.Export%></a>
                </div>
            <div>
                <%=Global.dateFrom%>:
                <input id="ReceiveDateFrom" class="easyui-datebox" style="width: 100px">
                <%=Global.dateTo%>:
                <input id="ReceiveDateTo" class="easyui-datebox" style="width: 100px">
                 <%=Global.FileName%>:<input id="FileName" class="easyui-validatebox" style="width: 120px">
                <%=Global.InvoiceNoEEM%>.:<input id="InvoiceNo" class="easyui-validatebox" style="width: 100px">
                <br>
                <%=Global.FolderLevelA%>:
                <input id="FolderLevelA" class="easyui-combobox" style="width: 100px" valuefield="FolderCode"
                    textfield="FolderName" multiple="false" editable="false">
                   <%=Global.FolderLevelB%>:
                <input id="FolderLevelB" class="easyui-combobox" style="width: 100px" valuefield="FolderCode"
                    textfield="FolderName" multiple="false" editable="false" disabled="true">
               <%=Global.CheckType%>:
                <input id="CheckType" url="/MSDEEM/GetFolderLevel?id=0" class="easyui-combobox" style="width: 100px"
                    valuefield="FolderCode" textfield="FolderName" multiple="false" editable="false">
               
                <%=Global.WorkStatus%>:<input id="WorkStatus" class="easyui-combobox" style="width: 110px" url="/MSDEEM/GetWorkStutes"
                    valuefield="WorkStatusCode" textfield="WorkStatusNameEEM" editable="false">
                   
                <%=Global.ReasonTitle%>:<input id="Reason" name="Reason" class="easyui-combobox" style="width: 150px" url="/GPEEM/GetCaseReasonList"
                    valuefield="Id" textfield="JpReason" editable="false">
                      <%=Global.PaymentEEM%>:<input id="Payment" class="easyui-combobox" style="width: 110px" url="/GPEEM/GetPayments"
                    valuefield="PaymentId" textfield="PaymentName" editable="false">
            </div>
        </div>
        </table>
        </div>
        </form>

</asp:Content>
